home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_319
/
cnewssrc
/
cnews.orig.lzh
/
libcnews
/
strsave.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
468b
|
24 lines
/*
* strsave - like strdup, but error if can't allocate
*/
#include <stdio.h>
#include <sys/types.h>
#include "libc.h"
#include "news.h"
/*
* Copy "s" into malloced memory, if any is available.
* If not, unlock the news system, print a message and exit,
* else return the address of the malloced memory.
*/
char *
strsave(s)
register char *s;
{
register char *news =nemalloc((unsigned)strlen(s)+1); /* include NUL */
(void) strcpy(news, s);
return news;
}